package com.tengju.data.infrastructure.repository.convert;

import com.tengju.data.domain.model.user.ReportDealerNewUserInfo;
import com.tengju.data.domain.model.user.UserIdCode;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.ReportDealerNewUserDO;

/**
 * 
 * @Date: 2021/7/13 17:42
 * @Description: 
 */
public class ReportDealerNewUserConvert {

    public static ReportDealerNewUserInfo toModel(ReportDealerNewUserDO reportDealerNewUserDO) {
        if (reportDealerNewUserDO == null) {
            return null;
        }
        return new ReportDealerNewUserInfo(
                new UserIdCode(reportDealerNewUserDO.getIdCode()),
                reportDealerNewUserDO.getLevel1NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel1NewCnt(),
                reportDealerNewUserDO.getLevel2NewCnt() == null ? 0L :reportDealerNewUserDO.getLevel2NewCnt(),
                reportDealerNewUserDO.getLevel3NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel3NewCnt(),
                reportDealerNewUserDO.getLevel4NewCnt() == null ? 0L : reportDealerNewUserDO.getLevel4NewCnt(),
                reportDealerNewUserDO.getVisit_date(),
                reportDealerNewUserDO.getMonth()
        );

    }
}
